/**
 */
package artefact.generic.impl;

import artefact.generic.ConstructionPrimitive;
import artefact.generic.GenericPackage;

import java.math.BigInteger;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.gmt.modisco.java.ASTNode;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Construction Primitive</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link artefact.generic.impl.ConstructionPrimitiveImpl#getNext <em>Next</em>}</li>
 *   <li>{@link artefact.generic.impl.ConstructionPrimitiveImpl#getId <em>Id</em>}</li>
 *   <li>{@link artefact.generic.impl.ConstructionPrimitiveImpl#getLien <em>Lien</em>}</li>
 *   <li>{@link artefact.generic.impl.ConstructionPrimitiveImpl#getNode <em>Node</em>}</li>
 *   <li>{@link artefact.generic.impl.ConstructionPrimitiveImpl#getOwnerNode <em>Owner Node</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ConstructionPrimitiveImpl extends EObjectImpl implements ConstructionPrimitive {
	/**
	 * The cached value of the '{@link #getNext() <em>Next</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNext()
	 * @generated
	 * @ordered
	 */
	protected ConstructionPrimitive next;

	/**
	 * The default value of the '{@link #getId() <em>Id</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected static final BigInteger ID_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected BigInteger id = ID_EDEFAULT;

	/**
	 * The default value of the '{@link #getLien() <em>Lien</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLien()
	 * @generated
	 * @ordered
	 */
	protected static final String LIEN_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getLien() <em>Lien</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLien()
	 * @generated
	 * @ordered
	 */
	protected String lien = LIEN_EDEFAULT;

	/**
	 * The default value of the '{@link #getNode() <em>Node</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNode()
	 * @generated
	 * @ordered
	 */
	protected static final ASTNode NODE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getNode() <em>Node</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNode()
	 * @generated
	 * @ordered
	 */
	protected ASTNode node = NODE_EDEFAULT;

	/**
	 * The default value of the '{@link #getOwnerNode() <em>Owner Node</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOwnerNode()
	 * @generated
	 * @ordered
	 */
	protected static final ASTNode OWNER_NODE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getOwnerNode() <em>Owner Node</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOwnerNode()
	 * @generated
	 * @ordered
	 */
	protected ASTNode ownerNode = OWNER_NODE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ConstructionPrimitiveImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return GenericPackage.Literals.CONSTRUCTION_PRIMITIVE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConstructionPrimitive getNext() {
		if (next != null && next.eIsProxy()) {
			InternalEObject oldNext = (InternalEObject)next;
			next = (ConstructionPrimitive)eResolveProxy(oldNext);
			if (next != oldNext) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, GenericPackage.CONSTRUCTION_PRIMITIVE__NEXT, oldNext, next));
			}
		}
		return next;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConstructionPrimitive basicGetNext() {
		return next;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNext(ConstructionPrimitive newNext) {
		ConstructionPrimitive oldNext = next;
		next = newNext;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GenericPackage.CONSTRUCTION_PRIMITIVE__NEXT, oldNext, next));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BigInteger getId() {
		return id;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setId(BigInteger newId) {
		BigInteger oldId = id;
		id = newId;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GenericPackage.CONSTRUCTION_PRIMITIVE__ID, oldId, id));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getLien() {
		return lien;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLien(String newLien) {
		String oldLien = lien;
		lien = newLien;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GenericPackage.CONSTRUCTION_PRIMITIVE__LIEN, oldLien, lien));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ASTNode getNode() {
		return node;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNode(ASTNode newNode) {
		ASTNode oldNode = node;
		node = newNode;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GenericPackage.CONSTRUCTION_PRIMITIVE__NODE, oldNode, node));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ASTNode getOwnerNode() {
		return ownerNode;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setOwnerNode(ASTNode newOwnerNode) {
		ASTNode oldOwnerNode = ownerNode;
		ownerNode = newOwnerNode;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GenericPackage.CONSTRUCTION_PRIMITIVE__OWNER_NODE, oldOwnerNode, ownerNode));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case GenericPackage.CONSTRUCTION_PRIMITIVE__NEXT:
				if (resolve) return getNext();
				return basicGetNext();
			case GenericPackage.CONSTRUCTION_PRIMITIVE__ID:
				return getId();
			case GenericPackage.CONSTRUCTION_PRIMITIVE__LIEN:
				return getLien();
			case GenericPackage.CONSTRUCTION_PRIMITIVE__NODE:
				return getNode();
			case GenericPackage.CONSTRUCTION_PRIMITIVE__OWNER_NODE:
				return getOwnerNode();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case GenericPackage.CONSTRUCTION_PRIMITIVE__NEXT:
				setNext((ConstructionPrimitive)newValue);
				return;
			case GenericPackage.CONSTRUCTION_PRIMITIVE__ID:
				setId((BigInteger)newValue);
				return;
			case GenericPackage.CONSTRUCTION_PRIMITIVE__LIEN:
				setLien((String)newValue);
				return;
			case GenericPackage.CONSTRUCTION_PRIMITIVE__NODE:
				setNode((ASTNode)newValue);
				return;
			case GenericPackage.CONSTRUCTION_PRIMITIVE__OWNER_NODE:
				setOwnerNode((ASTNode)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case GenericPackage.CONSTRUCTION_PRIMITIVE__NEXT:
				setNext((ConstructionPrimitive)null);
				return;
			case GenericPackage.CONSTRUCTION_PRIMITIVE__ID:
				setId(ID_EDEFAULT);
				return;
			case GenericPackage.CONSTRUCTION_PRIMITIVE__LIEN:
				setLien(LIEN_EDEFAULT);
				return;
			case GenericPackage.CONSTRUCTION_PRIMITIVE__NODE:
				setNode(NODE_EDEFAULT);
				return;
			case GenericPackage.CONSTRUCTION_PRIMITIVE__OWNER_NODE:
				setOwnerNode(OWNER_NODE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case GenericPackage.CONSTRUCTION_PRIMITIVE__NEXT:
				return next != null;
			case GenericPackage.CONSTRUCTION_PRIMITIVE__ID:
				return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
			case GenericPackage.CONSTRUCTION_PRIMITIVE__LIEN:
				return LIEN_EDEFAULT == null ? lien != null : !LIEN_EDEFAULT.equals(lien);
			case GenericPackage.CONSTRUCTION_PRIMITIVE__NODE:
				return NODE_EDEFAULT == null ? node != null : !NODE_EDEFAULT.equals(node);
			case GenericPackage.CONSTRUCTION_PRIMITIVE__OWNER_NODE:
				return OWNER_NODE_EDEFAULT == null ? ownerNode != null : !OWNER_NODE_EDEFAULT.equals(ownerNode);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (id: ");
		result.append(id);
		result.append(", lien: ");
		result.append(lien);
		result.append(", node: ");
		result.append(node);
		result.append(", ownerNode: ");
		result.append(ownerNode);
		result.append(')');
		return result.toString();
	}

} //ConstructionPrimitiveImpl
